class Register {
    constructor() {
        this.init();
    }
    init() {
        // this.loginNews = $(".qrbox").next()[0];
        // this.qrBox = $(".qrbox")[0];
        this.chooseLogin = $(".login_content_title")[0];
        this.contentContList = $(".login_content_cont")[0].children
        this.username = $("#username")[0]
        this.password = $("#password")[0]
        this.btn = $("#btn_submit")[0]
        this.tips1 = $(".tips1")[0]



        $("#btn_submit").on("click", $.proxy(this.getUserNew, this));
        $(".login_content_title").on("click", "li", $.proxy(this.showChoose, this));
        $(".ewmbox").hover(function () {
            $(".ewmbox").addClass("ewmbox2")
        }, function () {
            $(".ewmbox").removeClass("ewmbox2")
        })

        $("input").focus(function (evt) {
            var e = evt || event;
            var target = e.target || e.srcElement;
            target.placeholder = "";
            target.style.border = "1px solid rgb(255,173,119)";
        })
        $("input").blur(function (evt) {
            var e = evt || event;
            var target = e.target || e.srcElement;
            target.placeholder = "请输入正确的格式"
            target.style.border = "1px solid rgb(222,222,222)"
        })
    }

 
    showChoose(evt) {
        var e = evt || event;
        var target = e.target || e.srcElement;
        for (var i = 0, item; item = this.chooseLogin.children[i++];) {
            if (item == target) {
                target.className = "active"
                this.contentContList[i - 1].style.display = "block"
            } else {
                item.className = ""
                this.contentContList[i - 1].style.display = "none"
            }
        }
    }

    getUserNew() {
        var username = this.username.value;
        var password = this.password.value;
        // this.btn.disabled = "disabled";
        var url = "../server/login.php"
        ajax(
            url, {
                data: {
                    username: username,
                    password: password
                },
                type: "GET",
                // dataType:"json"
            })
    }


}
new Register();